/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import classes.Usuario;
import hibernate.HibernateUtil;
import javax.transaction.Transaction;
import org.hibernate.HibernateException;
import org.hibernate.Session;

/**
 *
 * @author GEMADA
 */
public class UsuarioHibernateDAO {
    
    private Session session;  
    private Class persistentClass;  
    private Transaction transaction;
    
    public UsuarioHibernateDAO(){
    }
    
    public UsuarioHibernateDAO(Class persistentClass) {  
        this.persistentClass = persistentClass;  
    }  
  
    public Object findByIdPk(String login, String senha) {  
        Object returnObject = null;  
        try {  
            session = HibernateUtil.getSessionFactory().openSession();  
            returnObject = session.get(persistentClass, login);  
        } catch (HibernateException e) {  
            System.out.println("FindById_HibernateDAO: " + e);  
        } finally {  
            return returnObject;  
        }  
    } 
    
}
